<template>
	<view class="container">
		<block v-if="isload">
			<view class="ordertop" :style="'background:' + t('color2') + ';background-size:100%'">
				<!-- <view class="ordertop"> -->
				<view class="f1" v-if="detail.status == 0">
					<view class="t1">等待买家付款</view>
					<view class="t2" v-if="djs">剩余时间：{{ djs }}</view>
					<view class="t2" v-if="detail.paytypeid == 5">
						<text v-if="detail.transfer_check == 1">转账汇款后请上传付款凭证</text>
						<text v-if="detail.transfer_check == 0">转账待审核</text>
						<text v-if="detail.transfer_check == -1">转账已驳回</text>
					</view>
				</view>
				<view class="f1" v-if="detail.status == 4">
					<view class="t1">订单已取消</view>
				</view>
				<!-- <view class="f1" v-if="detail.status == 1 ">
					<view class="t1">{{ detail.paytypeid == 4 ? '已选择' + detail.paytype : '已成功付款' }}</view>
					<view class="t2" v-if="detail.freight_type != 1">我们会尽快为您发货</view>
					<view class="t2" v-if="detail.freight_type == 1">请尽快前往自提地点取货</view>
				</view>
				<view class="f1" v-if="detail.status == 2">
					<view class="t1">订单已发货</view>
					<text class="t2" v-if="detail.freight_type != 3" user-select="true"
						selectable="true">发货信息：{{ detail.express_com }} {{ detail.express_no }}</text>
				</view> -->
				<view class="f1" v-if="detail.status == 3 && detail.freight_id == 0">
					<view class="t1">订单已完成</view>
				</view>
				<!-- <view class="f1" v-if="detail.status == 4">
					<view class="t1">订单已取消</view>
				</view> -->
				<block v-if="detail.status !== 0 && detail.status !== 4 && detail.freight_id !== 0">
					<view class="show-tips" v-if="showTip">
						<view class="title-top">
							{{
                detail.express_com == null || detail.express_com == undefined
                  ? ""
                  : detail.express_com
              }}
							{{
                detail.express_no == null || detail.express_no == undefined
                  ? ""
                  : detail.express_no
              }}
						</view>
						<block v-if="data_list.type == 2">
							<scroll-view scroll-x>
								<view class="tab-header">
									<view v-for="(tab, index) in datalist" :key="index" class="tab-item"
										:class="{ active: currentTab == index }" @tap="switchTab(index)">
										{{
                      tab.express_no.includes(":")
                        ? tab.express_no.split(":")[0]
                        : tab.express_no
                    }}
									</view>
								</view>
								<view class="" v-if="currentTab >= 0">
									<view class="tips-box-left">
										<view v-if="
                        datalist[currentTab].logistics &&
                        datalist[currentTab].logistics[0]
                      ">
											<view class="tips-text">
												{{ datalist[currentTab].logistics[0].AcceptStation }}
											</view>
											<view class="tips-time">
												{{ datalist[currentTab].logistics[0].AcceptTime }}
											</view>
										</view>
										<view v-else> 暂无物流信息 </view>
									</view>
								</view>
							</scroll-view>
						</block>
						<block v-else>
							<view class="tips-box" @tap="logistics" :data-express_type="detail.express_type"
								:data-express_com="detail.express_com" :data-express_no="detail.express_no"
								:data-express_content="detail.express_content">
								<view class="tips-box-left">
									<view class="tips-text">
										{{ datalist[0].context }}
									</view>
									<view class="tips-time">
										{{ datalist[0].time }}
									</view>
								</view>
								<view class="tips-box-right">
									<image class="arrow-right" src="/static/img/arrowright.png" mode=""></image>
								</view>
							</view>
						</block>
					</view>
					<view class="tips-wl" v-else> 物流信息加载中... </view>
				</block>
			</view>
			<view class="address">
				<view class="img">
					<image src="/static/img/address3.png"></image>
				</view>
				<view class="info" v-if="detail.mdid == -1">
					<view class="t1"><text user-select="true" selectable="true">{{ detail.linkman }}
							{{ detail.tel }}</text>
					</view>
					<view class="t1" style="margin-top: 20rpx">取货地点：</view>
					<view>
						<block v-for="(item, idx) in storelist" :key="idx">
							<view class="radio-item" v-if="idx < 5 || storeshowall == true" @tap="openLocation"
								:data-latitude="item.latitude" :data-longitude="item.longitude"
								:data-company="item.name" :data-address="item.address">
								<view class="f1">
									<view>{{ item.name }}</view>
									<view v-if="item.address" class="flex-y-center" style="
                      font-size: 24rpx;
                      color: #aaaaae;
                      display: -webkit-box;
                      -webkit-box-orient: vertical;
                      -webkit-line-clamp: 1;
                      overflow: hidden;
                    ">
										{{ item.address }}
									</view>
								</view>
								<text style="color: #f50">{{ item.juli }}</text>
							</view>
						</block>
						<view v-if="storeshowall == false && storelist.length > 5" class="storeviewmore"
							@tap="doStoreShowAll">- 查看更多 -
						</view>
					</view>
				</view>
				<view class="info" v-else>
					<text class="t1" user-select="true" selectable="true">{{ detail.linkman }} {{ detail.tel }}</text>
					<text class="t2" v-if="detail.freight_type != 1 && detail.freight_type != 3" user-select="true"
						selectable="true">地址：{{ detail.area }}{{ detail.address }}</text>
					<text class="t2" v-if="detail.freight_type == 1" @tap="openMendian" :data-storeinfo="storeinfo"
						user-select="true" selectable="true">取货地点：{{ storeinfo.name }} - {{ storeinfo.address }}
					</text>
				</view>
			</view>
			<view class="btitle flex-y-center" v-if="detail.bid > 0" @tap="goto"
				:data-url="'/pagesExt/business/index?id=' + detail.bid">
				<image :src="detail.binfo.logo" style="width: 36rpx; height: 36rpx"></image>
				<view class="flex1" decode="true" space="true" style="padding-left: 16rpx">{{ detail.binfo.name }}
				</view>
			</view>
			<view class="product">
				<view v-for="(item, idx) in prolist" :key="idx" class="box">
					<view class="content">
						<!-- <view @tap="goto" :data-url="'/pages/shop/product?id=' + item.proid">
							<image :src="item.pic"></image>
						</view> -->
						<view @tap.stop="gotoproid(item, detail.from_order_type)">
							<image :src="item.pic"></image>
						</view>
						<view class="detail">
							<text class="t1">{{ item.name }}</text>
							<!-- <view class="t2 flex flex-y-center flex-bt">
								<text>{{ item.ggname }}</text>
								<view class="btn3"
									v-if="detail.status == 3 && item.iscomment == 0 && shopset.comment == 1"
									@tap.stop="goto" :data-url="'comment?ogid=' + item.id + '&proid=' + item.proid">去评价
								</view>
								<view class="btn3" v-if="detail.status == 3 && item.iscomment == 1" @tap.stop="goto"
									:data-url="'comment?ogid=' + item.id+'&proid=' + item.proid">查看评价</view>
							</view> -->
							<view class="t3"><text class="x1 flex1">￥{{ item.sell_price }}</text><text
									class="x2">×{{ item.num }}</text></view>
							<view class="t2 tgr" v-if="item.isrefund == 1">
								注：商品不允许退款
							</view>
							<!-- <view class="t4 flex flex-x-bottom">
							<view class="btn3" v-if="detail.status==3 && item.iscomment==0 && shopset.comment==1" @tap.stop="goto" :data-url="'comment?ogid=' + item.id">去评价</view>
							<view class="btn3" v-if="detail.status==3 && item.iscomment==1" @tap.stop="goto" :data-url="'comment?ogid=' + item.id">查看评价</view>
						</view> -->
							<block v-if="
                  (detail.status == 1 || detail.status == 2) && item.hexiao_code
                ">
								<view class="btn2" @tap.stop="showhxqr2" :data-id="item.id" :data-num="item.num"
									:data-hxnum="item.hexiao_num" :data-hexiao_code="item.hexiao_code"
									style="position: absolute; top: 20rpx; right: 0rpx">核销码</view>
							</block>
						</view>
					</view>
					<!-- glassinfo -->
					<view class="glassitem" v-if="item.glassrecord">
						<view class="gcontent">
							<view class="glassheader">
								{{ item.glassrecord.name }}
								{{ item.glassrecord.nickname ? item.glassrecord.nickname : "" }}
								{{
                  item.glassrecord.check_time ? item.glassrecord.check_time : ""
                }}
								{{ item.glassrecord.typetxt }}
								<text class="pdl10" v-if="item.glassrecord.double_ipd == 0">{{
                  item.glassrecord.ipd ? "PD" + item.glassrecord.ipd : ""
                }}</text>
								<text class="pdl10" v-else>PD R{{ item.glassrecord.ipd_right }} L{{
                    item.glassrecord.ipd_left
                  }}</text>
							</view>
							<view class="glassrow bt">
								<view class="grow">
									R
									{{ item.glassrecord.degress_right }}/{{
                    item.glassrecord.ats_right
                      ? item.glassrecord.ats_right
                      : "0.00"
                  }}*{{
                    item.glassrecord.ats_zright
                      ? item.glassrecord.ats_zright
                      : "0"
                  }}
									<text class="pdl10" v-if="item.glassrecord.type == 3">ADD+{{
                      item.glassrecord.add_right
                        ? item.glassrecord.add_right
                        : 0
                    }}</text>
								</view>
								<view class="grow">
									L
									{{ item.glassrecord.degress_left }}/{{
                    item.glassrecord.ats_left
                      ? item.glassrecord.ats_left
                      : "0.00"
                  }}*{{
                    item.glassrecord.ats_zleft
                      ? item.glassrecord.ats_zleft
                      : "0"
                  }}
									<text class="pdl10" v-if="item.glassrecord.type == 3">ADD+{{
                      item.glassrecord.add_left ? item.glassrecord.add_left : 0
                    }}</text>
								</view>
							</view>
							<view class="glassrow" v-if="item.glassrecord.remark">{{
                item.glassrecord.remark
              }}</view>
						</view>
					</view>
					<!-- glassinfo -->
				</view>
			</view>

			<view class="orderinfo" v-if="
          (detail.status == 3 || detail.status == 2) &&
          (detail.freight_type == 3 || detail.freight_type == 4)
        ">
				<view class="item flex-col">
					<text class="t1" style="color: #111">发货信息</text>
					<text class="t2" style="text-align: left; margin-top: 10rpx; padding: 0 10rpx" user-select="true"
						selectable="true">{{ detail.freight_content }}</text>
				</view>
			</view>

			<view class="orderinfo">
				<view class="item">
					<text class="t1">订单编号</text>
					<text class="t2" user-select="true" selectable="true">{{
            detail.ordernum
          }}</text>
				</view>
				<view class="item">
					<text class="t1">下单时间</text>
					<text class="t2">{{ detail.createtime }}</text>
				</view>
				<view class="item" v-if="detail.status > 0 && detail.paytypeid != '4' && detail.paytime">
					<text class="t1">支付时间</text>
					<text class="t2">{{ detail.paytime }}</text>
				</view>
				<view class="item" v-if="detail.paytypeid">
					<text class="t1">支付方式</text>
					<text class="t2">{{ detail.paytype }}</text>
				</view>
				<view class="item" v-if="detail.yuding_type == '1'">
					<text class="t1">订单类型</text>
					<text class="t2">预定订单</text>
				</view>
				<block v-if="detail.paytypeid == '5' && detail.transfer_check == 1">
					<view class="item" v-if="pay_transfer_info.pay_transfer_account_name">
						<text class="t1">户名</text>
						<text class="t2">{{
              pay_transfer_info.pay_transfer_account_name
            }}</text>
					</view>
					<view class="item" v-if="pay_transfer_info.pay_transfer_account">
						<text class="t1">账户</text>
						<text class="t2">{{ pay_transfer_info.pay_transfer_account }}</text>
					</view>
					<view class="item" v-if="pay_transfer_info.pay_transfer_bank">
						<text class="t1">开户行</text>
						<text class="t2">{{ pay_transfer_info.pay_transfer_bank }}</text>
					</view>
					<view class="item" v-if="pay_transfer_info.pay_transfer_desc">
						<text class="text-min">{{
              pay_transfer_info.pay_transfer_desc
            }}</text>
					</view>
					<view class="item">
						<text class="t1">付款凭证审核</text>
						<text class="t2">{{ payorder.check_status_label }}</text>
					</view>
					<view class="item" v-if="payorder.check_remark">
						<text class="t1">审核备注</text>
						<text class="t2">{{ payorder.check_remark }}</text>
					</view>
				</block>
				<view class="item" v-if="detail.status > 1 && detail.send_time">
					<text class="t1">发货时间</text>
					<text class="t2">{{ detail.send_time }}</text>
				</view>
				<view class="item" v-if="detail.status == 3 && detail.collect_time">
					<text class="t1">收货时间</text>
					<text class="t2">{{ detail.collect_time }}</text>
				</view>
			</view>
			<view class="orderinfo">
				<view class="item">
					<text class="t1">商品金额</text>
					<text class="t2 red">¥{{ detail.product_price }}</text>
				</view>
				<view class="item" v-if="detail.leveldk_money > 0">
					<text class="t1">{{ t("会员") }}折扣</text>
					<text class="t2 red">-¥{{ detail.leveldk_money }}</text>
				</view>
				<view class="item" v-if="detail.manjian_money > 0">
					<text class="t1">满减活动</text>
					<text class="t2 red">-¥{{ detail.manjian_money }}</text>
				</view>
				<view class="item" v-if="detail.invoice_money > 0">
					<text class="t1">发票费用</text>
					<text class="t2 red">+¥{{ detail.invoice_money }}</text>
				</view>
				<view class="item">
					<text class="t1">配送方式</text>
					<text class="t2">{{ detail.freight_text }}</text>
				</view>
				<view class="item" v-if="detail.freight_type == 1 && detail.freightprice > 0">
					<text class="t1">服务费</text>
					<text class="t2 red">+¥{{ detail.freight_price }}</text>
				</view>
				<view class="item" v-if="detail.freight_time">
					<text class="t1">{{ detail.freight_type != 1 ? "配送" : "提货" }}时间</text>
					<text class="t2">{{ detail.freight_time }}</text>
				</view>
				<view class="item" v-if="detail.coupon_money > 0">
					<text class="t1">{{ t("优惠券") }}抵扣</text>
					<text class="t2 red">-¥{{ detail.coupon_money }}</text>
				</view>

				<view class="item" v-if="detail.scoredk_money > 0">
					<text class="t1">{{ t("积分") }}抵扣</text>
					<text class="t2 red">-¥{{ detail.scoredk_money }}</text>
				</view>
				<view class="item" v-if="detail.dec_money > 0">
					<text class="t1">{{ t("余额") }}抵扣</text>
					<text class="t2 red">-¥{{ detail.dec_money }}</text>
				</view>
				<view class="item">
					<text class="t1">实付款</text>
					<text class="t2 red"><text
							v-if="showprice_dollar && detail.usd_totalprice > 0">${{ detail.usd_totalprice }}</text>
						¥{{ detail.totalprice }}</text>
				</view>
				<view class="item" v-if="detail.is_yuanbao_pay == 1">
					<text class="t1">{{ t("元宝") }}</text>
					<text class="t2 red">{{ detail.total_yuanbao }}</text>
				</view>
				<view class="item">
					<text class="t1">订单状态</text>
					<text class="t2" v-if="detail.status == 0">未付款</text>
					<text class="t2" v-if="detail.status == 1">{{
            detail.paytypeid == 4 ? "待发货" : "已支付"
          }}</text>
					<text class="t2" v-if="detail.status == 2 && detail.express_isbufen == 0">已发货</text>
					<text class="t2" v-if="detail.status == 2 && detail.express_isbufen == 1">部分发货</text>
					<text class="t2" v-if="detail.status == 3">已完成</text>
					<text class="t2" v-if="detail.status == 4">已关闭</text>
				</view>
				<view class="item" v-if="detail.refundingMoneyTotal > 0">
					<text class="t1">退款中</text>
					<text class="t2 red" @tap="goto"
						:data-url="'refundlist?orderid=' + detail.id">¥{{ detail.refundingMoneyTotal }}</text>
					<text class="t3 iconfont iconjiantou" style="color: #999; font-weight: normal"></text>
				</view>
				<view class="item" v-if="detail.refundedMoneyTotal > 0">
					<text class="t1">已退款</text>
					<text class="t2 red" @tap="goto"
						:data-url="'refundlist?orderid=' + detail.id">¥{{ detail.refundedMoneyTotal }}</text>
					<text class="t3 iconfont iconjiantou" style="color: #999; font-weight: normal"></text>
				</view>
				<view class="item" v-if="detail.refund_status > 0">
					<text class="t1">退款状态</text>
					<text class="t2 red" v-if="detail.refund_status == 1">审核中</text>
					<text class="t2 red" v-if="detail.refund_status == 2">已退款</text>
					<text class="t2 red" v-if="detail.refund_status == 3">已驳回</text>
				</view>

				<view class="item" v-if="detail.balance_price > 0">
					<text class="t1">尾款</text>
					<text class="t2 red">¥{{ detail.balance_price }}</text>
				</view>
				<view class="item" v-if="detail.balance_price > 0">
					<text class="t1">尾款状态</text>
					<text class="t2" v-if="detail.balance_pay_status == 1">已支付</text>
					<text class="t2" v-if="detail.balance_pay_status == 0">未支付</text>
				</view>
			</view>
			<view class="orderinfo" v-if="detail.checkmemid">
				<view class="item">
					<text class="t1">所选会员</text>
					<text class="flex1"></text>
					<image :src="detail.checkmember.headimg" style="width: 80rpx; height: 80rpx; margin-right: 8rpx" />
					<text style="height: 80rpx; line-height: 80rpx">{{
            detail.checkmember.nickname
          }}</text>
				</view>
			</view>
			<view class="orderinfo" v-if="detail.formdata.length > 0">
				<view class="item" v-for="item in detail.formdata" :key="index">
					<text class="t1">{{ item[0] }}</text>
					<view class="t2" v-if="item[2] == 'upload'">
						<image :src="item[1]" style="width: 400rpx; height: auto" mode="widthFix" @tap="previewImage"
							:data-url="item[1]" />
					</view>
					<text class="t2" v-else user-select="true" selectable="true">{{
            item[1]
          }}</text>
				</view>
			</view>
			<view class="orderinfo" v-if="detail.freight_type == 11">
				<view class="item">
					<text class="t1">发货地址</text>
					<text class="t2">¥{{ detail.freight_content.send_address }} -
						{{ detail.freight_content.send_tel }}</text>
				</view>
				<view class="item">
					<text class="t1">收货地址</text>
					<text class="t2">¥{{ detail.freight_content.receive_address }} -
						{{ detail.freight_content.receive_tel }}</text>
				</view>
			</view>

			<view style="width: 100%; height: 160rpx"></view>

			<view class="bottom notabbarbot" v-if="fromfenxiao == 0">
				<block v-if="detail.payaftertourl && detail.payafterbtntext">
					<view style="position: relative">
						<block v-if="detail.payafter_username">
							<view class="btn2">{{ detail.payafterbtntext }}</view>
							<!-- #ifdef H5 -->
							<wx-open-launch-weapp :username="detail.payafter_username" :path="detail.payafter_path"
								style="
                  position: absolute;
                  top: 0;
                  left: 0;
                  right: 0;
                  bottom: 0;
                  z-index: 8;
                ">
								<script type="text/wxtag-template">
									<div style="width:100%;height:40px;"></div>
                </script>
							</wx-open-launch-weapp>
							<!-- #endif -->
						</block>
						<block v-else>
							<view class="btn2" @tap="goto" :data-url="detail.payaftertourl">{{ detail.payafterbtntext }}
							</view>
						</block>
					</view>
				</block>
				<block v-if="detail.isworkorder == 1">
					<view class="btn2" @tap="goto" :data-url="'/activity/workorder/index?type=1&id=' + detail.id"
						:data-id="detail.id">发起工单</view>
				</block>
				<block v-if="detail.status == 0">
					<view class="btn2" @tap="toclose" :data-id="detail.id">关闭订单</view>
					<view class="btn1" v-if="detail.paytypeid != 5" :style="{ background: t('color1') }" @tap="goto"
						:data-url="'/pages/pay/pay?id=' + detail.payorderid">去付款</view>
					<block v-if="detail.paytypeid == 5">
						<view class="btn1" v-if="detail.transfer_check == 1" :style="{ background: t('color1') }"
							@tap="goto" :data-url="'/pages/pay/transfer?id=' + detail.payorderid">上传付款凭证</view>
						<view class="btn1" v-if="detail.transfer_check == 0" :style="{ background: t('color1') }">转账待审核
						</view>
						<view class="btn1" v-if="detail.transfer_check == -1" :style="{ background: t('color1') }">转账已驳回
						</view>
					</block>
				</block>
				<block v-if="detail.status == 1">
					<block v-if="detail.paytypeid != '4' && detail.canrefund == 0">
						<view class="btn2" @tap="goto" :data-url="'refundSelect?orderid=' + detail.id" v-if="
                shopset.canrefund == 1 && detail.refundnum < detail.procount
              ">退款</view>
					</block>
					<block v-else>
						<!-- <view class="btn2">{{codtxt}}</view> -->
					</block>
				</block>
				<block v-if="
            (detail.status == 2 || detail.status == 3) &&
            detail.freight_type != 3 &&
            detail.freight_type != 4
          ">
					<view class="btn2" v-if="detail.express_type == 'express_wx'" @tap="logistics"
						:data-express_type="detail.express_type" :data-express_com="detail.express_com"
						:data-express_no="detail.express_no" :data-express_content="detail.express_content">订单跟踪</view>
					<view class="btn2" v-else-if="detail.freight_id !== 0" @tap="logistics"
						:data-express_type="detail.express_type" :data-express_com="detail.express_com"
						:data-express_no="detail.express_no" :data-express_content="detail.express_content" :data-from_order_type="detail.from_order_type" :data-from_order_id="detail.from_order_id">查看物流</view>
				</block>
				<block v-if="detail.status == 3">
					<view class="btn2" v-if="showViewComment" @tap.stop="goto" :data-url="'comment?ogid=' + detail.id">
						查看评价
					</view>
					<view class="btn2" v-else @tap.stop="goto" :data-url="'comment?ogid=' + detail.id">
						去评价
					</view>
				</block>
				<block v-if="[1, 2, 3].includes(detail.status) && invoice">
					<view class="btn2" @tap="goto" :data-url="'invoice?type=shop&orderid=' + detail.id">发票</view>
				</block>
				<block v-if="detail.status == 2">
					<block v-if="detail.paytypeid != '4' && detail.canrefund == 0">
						<view class="btn2" @tap="goto" :data-url="'refundSelect?orderid=' + detail.id" v-if="
                shopset.canrefund == 1 && detail.refundnum < detail.procount
              ">退款</view>
					</block>
					<view class="btn1" :style="{ background: t('color1') }" @tap="orderCollect" :data-id="detail.id"
						v-if="
              detail.paytypeid != '4' &&
              (detail.balance_pay_status == 1 || detail.balance_price == 0)
            ">
						确认收货
					</view>
					<!-- <view class="btn2" v-if="detail.paytypeid=='4'">{{codtxt}}</view> -->
					<view v-if="detail.balance_pay_status == 0 && detail.balance_price > 0" class="btn1"
						:style="{ background: t('color1') }" @tap.stop="goto"
						:data-url="'/pages/pay/pay?id=' + detail.balance_pay_orderid">支付尾款</view>
				</block>
				<block v-if="
            (detail.status == 1 || detail.status == 2) &&
            detail.freight_type == 1 &&
            detail.hexiao_qr
          ">
					<view class="btn2" @tap="showhxqr" :data-hexiao_qr="detail.hexiao_qr">核销码</view>
				</block>
				<view v-if="detail.refundCount" class="btn2" @tap.stop="goto"
					:data-url="'refundlist?orderid=' + detail.id">查看退款</view>
				<block v-if="detail.status == 3 || detail.status == 4">
					<view class="btn2" @tap="todel" :data-id="detail.id">删除订单</view>
				</block>
				<block v-if="detail.bid > 0 && detail.status == 3 && 0">
					<view v-if="iscommentdp == 0" class="btn1" :style="{ background: t('color1') }" @tap="goto"
						:data-url="'/pagesExt/order/commentdp?orderid=' + detail.id">评价店铺</view>
					<view v-if="iscommentdp == 1" class="btn2" @tap="goto"
						:data-url="'/pagesExt/order/commentdp?orderid=' + detail.id">查看评价</view>
				</block>
			</view>
			<uni-popup id="dialogHxqr" ref="dialogHxqr" type="dialog">
				<view class="hxqrbox">
					<image :src="hexiao_qr" @tap="previewImage" :data-url="hexiao_qr" class="img" />
					<view class="txt">请出示核销码给核销员进行核销</view>
					<view v-if="detail.hexiao_code_member">
						<input type="number" placeholder="请输入核销密码" @input="set_hexiao_code_member" style="
                border: 1px #eee solid;
                padding: 10rpx;
                margin: 20rpx 10rpx;
                height: 70rpx;
                border-radius: 4px;
                flex: 1;
                font-size: 28rpx;
              " />
						<button @tap="hexiao" class="btn" :style="{ background: t('color1') }">
							确定
						</button>
					</view>
					<view class="close" @tap="closeHxqr">
						<image src="/static/img/close2.png" style="width: 100%; height: 100%" />
					</view>
				</view>
			</uni-popup>

			<uni-popup id="dialogSelectExpress" ref="dialogSelectExpress" type="dialog">
				<view style="
            background: #fff;
            padding: 20rpx 30rpx;
            border-radius: 10rpx;
            width: 600rpx;
          " v-if="express_content">
					<view class="sendexpress" v-for="(item, index) in express_content" :key="index"
						style="border-bottom: 1px solid #f5f5f5; padding: 20rpx 0">
						<!-- <view class="sendexpress-item" @tap="logistics" :data-express_type="detail.express_type"
						:data-express_com="detail.express_com" :data-express_no="detail.express_no"
						:data-express_content="detail.express_content"
							style="display: flex;"> -->
						<view class="sendexpress-item" @tap="goto" :data-url="
                '/pagesExt/order/logistics?express_com=' +
                item.express_com +
                '&express_no=' +
                item.express_no +
                '&id=' +
                detail.id
              " style="display: flex">
							<view class="flex1" style="color: #121212">{{ item.express_com }} - {{ item.express_no }}
							</view>
							<image src="/static/img/arrowright.png" style="width: 30rpx; height: 30rpx" />
						</view>
						<view v-if="item.express_oglist" style="margin-top: 20rpx">
							<view class="oginfo-item" v-for="(item2, index2) in item.express_oglist" :key="index2"
								style="display: flex; align-items: center; margin-bottom: 10rpx">
								<image :src="item2.pic" style="
                    width: 50rpx;
                    height: 50rpx;
                    margin-right: 10rpx;
                    flex-shrink: 0;
                  " />
								<view class="flex1" style="color: #555">{{ item2.name }}({{ item2.ggname }})</view>
							</view>
						</view>
					</view>
				</view>
			</uni-popup>

			<view v-if="selecthxnumDialogShow" class="popup__container">
				<view class="popup__overlay" @tap.stop="hideSelecthxnumDialog"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">请选择核销数量</text>
						<image src="/static/img/close.png" class="popup__close" style="width: 36rpx; height: 36rpx"
							@tap.stop="hideSelecthxnumDialog" />
					</view>
					<view class="popup__content">
						<view class="pstime-item" v-for="(item, index) in hxnumlist" :key="index"
							@tap="hxnumRadioChange" :data-index="index">
							<view class="flex1">{{ item }}</view>
							<view class="radio" :style="
                  hxnum == item ? 'background:' + t('color1') + ';border:0' : ''
                ">
								<image class="radio-img" src="/static/img/checkd.png" />
							</view>
						</view>
					</view>
				</view>
			</view>
		</block>
		<loading v-if="loading"></loading>
		<dp-tabbar :opt="opt"></dp-tabbar>
		<popmsg ref="popmsg"></popmsg>
	</view>
</template>

<script>
	var app = getApp();
	var interval = null;

	export default {
		data() {
			return {
				opt: {},
				loading: false,
				isload: false,
				menuindex: -1,

				pre_url: app.globalData.pre_url,
				static_url: app.globalData.static_url,
				prodata: "",
				djs: "",
				iscommentdp: "",
				detail: "",
				payorder: {},
				prolist: "",
				shopset: "",
				storeinfo: "",
				lefttime: "",
				codtxt: "",
				pay_transfer_info: {},
				invoice: 0,
				selectExpressShow: false,
				express_content: "",
				fromfenxiao: 0,
				hexiao_code_member: "",
				showprice_dollar: false,
				hexiao_qr: "",
				selecthxnumDialogShow: false,
				hxogid: "",
				hxnum: "",
				hxnumlist: [],
				storelist: [],
				storeshowall: false,
				datalist: [],
				showTip: false,
				data_list: {},
				currentTab: 0,
			};
		},

		onLoad: function(opt) {
			this.opt = app.getopts(opt);
			if (this.opt && this.opt.fromfenxiao && this.opt.fromfenxiao == "1") {
				this.fromfenxiao = 1;
			}
			this.getdata();
		},
		onPullDownRefresh: function() {
			this.getdata();
		},
		onUnload: function() {
			clearInterval(interval);
		},
		computed: {
			showViewComment() {
				return this.prolist.every((product) => product.iscomment === 1);
			},
		},
		methods: {
			switchTab(index) {
				this.currentTab = index;
			},
			getLogistics() {
				var that = this;
				if (!that.detail) {
					return;
				}
				that.loading = true;
				app.get(
					"Order/logistics", {
						express_com: that.detail.express_com,
						express_no: that.detail.express_no,
						type: that.detail.type,
						order_id: that.detail.id,
					},
					function(res) {
						that.loading = false;
						that.data_list = res.data;
						that.datalist = res.data.datalist;
						that.showTip = true;
						that.loaded();
					}
				);
			},
			getdata: function() {
				var that = this;
				that.loading = true;
				app.get(
					"Order/detail", {
						id: that.opt.ordernum ? that.opt.ordernum : that.opt.id,
					},
					function(res) {
						that.loading = false;
						(that.iscommentdp = res.iscommentdp), (that.detail = res.detail);
						that.prolist = res.prolist;
						that.shopset = res.shopset;
						that.storeinfo = res.storeinfo;
						that.lefttime = res.lefttime;
						that.codtxt = res.codtxt;
						that.pay_transfer_info = res.pay_transfer_info;
						that.payorder = res.payorder;
						that.invoice = res.invoice;
						that.storelist = res.storelist || [];
						that.showprice_dollar = res.showprice_dollar;

						that.getLogistics();

						if (res.lefttime > 0) {
							interval = setInterval(function() {
								that.lefttime = that.lefttime - 1;
								that.getdjs();
							}, 1000);
						}
						that.loaded();
					}
				);
			},
			set_hexiao_code_member: function(e) {
				this.hexiao_code_member = e.detail.value;
			},
			hexiao: function() {
				let that = this;

				that.loading = true;
				app.post(
					"Order/hexiao", {
						orderid: that.opt.id,
						hexiao_code_member: that.hexiao_code_member,
					},
					function(res) {
						that.loading = false;
						if (res.status != 1) {
							app.error(res.msg);
							return;
						}
						app.success(res.msg);
						that.closeHxqr();
						setTimeout(function() {
							that.getdata();
						}, 1000);
					}
				);
			},
			getdjs: function() {
				var that = this;
				var totalsec = that.lefttime;

				if (totalsec <= 0) {
					that.djs = "00时00分00秒";
				} else {
					var houer = Math.floor(totalsec / 3600);
					var min = Math.floor((totalsec - houer * 3600) / 60);
					var sec = totalsec - houer * 3600 - min * 60;
					var djs =
						(houer < 10 ? "0" : "") +
						houer +
						"时" +
						(min < 10 ? "0" : "") +
						min +
						"分" +
						(sec < 10 ? "0" : "") +
						sec +
						"秒";
					that.djs = djs;
				}
			},
			todel: function(e) {
				var that = this;
				var orderid = e.currentTarget.dataset.id;
				app.confirm("确定要删除该订单吗?", function() {
					app.showLoading("删除中");
					app.post(
						"Order/delOrder", {
							orderid: orderid,
						},
						function(data) {
							app.showLoading(false);
							app.success(data.msg);
							setTimeout(function() {
								app.goback(true);
							}, 1000);
						}
					);
				});
			},
			toclose: function(e) {
				var that = this;
				var orderid = e.currentTarget.dataset.id;
				app.confirm("确定要关闭该订单吗?", function() {
					app.showLoading("提交中");
					app.post(
						"Order/closeOrder", {
							orderid: orderid,
						},
						function(data) {
							app.showLoading(false);
							app.success(data.msg);
							setTimeout(function() {
								that.getdata();
							}, 1000);
						}
					);
				});
			},
			orderCollect: function(e) {
				var that = this;
				var orderid = e.currentTarget.dataset.id;
				app.confirm("确定要收货吗?", function() {
					app.showLoading("收货中");
					app.post(
						"Order/orderCollect", {
							orderid: orderid,
						},
						function(data) {
							app.showLoading(false);
							app.success(data.msg);
							setTimeout(function() {
								that.getdata();
							}, 1000);
						}
					);
				});
			},
			showhxqr: function(e) {
				this.hexiao_qr = e.currentTarget.dataset.hexiao_qr;
				this.$refs.dialogHxqr.open();
			},
			closeHxqr: function() {
				this.$refs.dialogHxqr.close();
			},
			showhxqr2: function(e) {
				var that = this;
				var leftnum = e.currentTarget.dataset.num - e.currentTarget.dataset.hxnum;
				this.hxogid = e.currentTarget.dataset.id;
				if (leftnum <= 0) {
					app.alert("没有剩余核销数量了");
					return;
				}
				var hxnumlist = [];
				for (var i = 0; i < leftnum; i++) {
					hxnumlist.push(i + 1 + "");
				}
				if (hxnumlist.length > 6) {
					that.hxnumlist = hxnumlist;
					that.selecthxnumDialogShow = true;
					that.hxnum = "";
				} else {
					uni.showActionSheet({
						itemList: hxnumlist,
						success: function(res) {
							if (res.tapIndex >= 0) {
								that.hxnum = hxnumlist[res.tapIndex];
								that.gethxqr();
							}
						},
					});
				}
			},
			gethxqr() {
				var that = this;
				var hxnum = this.hxnum;
				var hxogid = this.hxogid;
				if (!hxogid) {
					app.alert("请选择要核销的商品");
					return;
				}
				if (!hxnum) {
					app.alert("请选择核销数量");
					return;
				}
				app.showLoading();
				app.post(
					"Order/getproducthxqr", {
						hxogid: hxogid,
						hxnum: hxnum,
					},
					function(data) {
						app.showLoading(false);
						if (data.status == 0) {
							app.alert(data.msg);
						} else {
							that.hexiao_qr = data.hexiao_qr;
							that.$refs.dialogHxqr.open();
						}
					}
				);
			},
			hxnumRadioChange: function(e) {
				var that = this;
				var index = e.currentTarget.dataset.index;
				this.hxnum = this.hxnumlist[index];
				setTimeout(function() {
					that.selecthxnumDialogShow = false;
					that.gethxqr();
				}, 200);
			},
			hideSelecthxnumDialog: function() {
				this.selecthxnumDialogShow = false;
			},
			openLocation: function(e) {
				var latitude = parseFloat(e.currentTarget.dataset.latitude);
				var longitude = parseFloat(e.currentTarget.dataset.longitude);
				var address = e.currentTarget.dataset.address;
				uni.openLocation({
					latitude: latitude,
					longitude: longitude,
					name: address,
					scale: 13,
				});
			},
			openMendian: function(e) {
				var storeinfo = e.currentTarget.dataset.storeinfo;
				app.goto("/pages/shop/mendian?id=" + storeinfo.id);
			},
			logistics: function(e) {
				var express_com = e.currentTarget.dataset.express_com;
				var express_no = e.currentTarget.dataset.express_no;
				var express_content = e.currentTarget.dataset.express_content;
				var express_type = e.currentTarget.dataset.express_type;
				var from_order_type = e.currentTarget.dataset.from_order_type;
				var from_order_id = e.currentTarget.dataset.from_order_id;
				var prolist = this.prolist;
				var id = this.opt.id;
				console.log(express_content);
				if (!express_content) {
					app.goto(
						"/pagesExt/order/logistics?express_com=" +
						express_com +
						"&express_no=" +
						express_no +
						"&type=" +
						express_type +
						"&id=" +
						id + "&from_order_type=" + from_order_type + "&from_order_id=" + from_order_id
					);
				} else {
					express_content = JSON.parse(express_content);
					for (var i in express_content) {
						if (express_content[i].express_ogids) {
							var express_ogids = express_content[i].express_ogids.split(",");
							console.log(express_ogids);
							var express_oglist = [];
							for (var j in prolist) {
								if (app.inArray(prolist[j].id + "", express_ogids)) {
									express_oglist.push(prolist[j]);
								}
							}
							express_content[i].express_oglist = express_oglist;
						}
					}
					this.express_content = express_content;
					this.$refs.dialogSelectExpress.open();
				}
			},
			hideSelectExpressDialog: function() {
				this.$refs.dialogSelectExpress.close();
			},
			doStoreShowAll: function() {
				this.storeshowall = true;
			},
			gotoproid(i, type) {
				if (type == "" || type == "shop") {
					app.goto("/pages/shop/product?id=" + i.proid + "&ptype=" + type);
				} else if (type == "seckill") {
					app.goto("/pages/shop/product?id=" + i.procode + "&ptype=" + type);
				} else if (type == "groupby") {
					app.goto("/pages/shop/product?id=" + i.procode + "&ptype=" + type);
				}
			},
		},
	};
</script>
<style>
	.text-min {
		font-size: 24rpx;
		color: #999;
	}

	/* .ordertop {
	width: 100%;
	height: 220rpx;
	padding: 50rpx 0 0 70rpx
} */
	.ordertop {
		width: 100%;
		height: auto;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 4;
		-webkit-box-orient: vertical;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 0 20rpx 20rpx;
	}

	.show-tips {
		width: 100%;
	}

	.ordertop .f1 {
		color: #fff;
	}

	.ordertop .f1 .t1 {
		font-size: 32rpx;
		height: 60rpx;
		line-height: 60rpx;
	}

	.ordertop .f1 .t2 {
		font-size: 24rpx;
	}

	.address {
		display: flex;
		width: 100%;
		padding: 20rpx 3%;
		background: #fff;
	}

	.address .img {
		width: 40rpx;
	}

	.address image {
		width: 40rpx;
		height: 40rpx;
	}

	.address .info {
		flex: 1;
		display: flex;
		flex-direction: column;
	}

	.address .info .t1 {
		font-size: 28rpx;
		font-weight: bold;
		color: #333;
	}

	.address .info .t2 {
		font-size: 24rpx;
		color: #999;
	}

	.product {
		width: 96%;
		margin: 0 2%;
		border-radius: 8rpx;
		margin-top: 16rpx;
		padding: 14rpx 3%;
		background: #fff;
	}

	.product .box {
		width: 100%;
		padding: 16rpx 0px;
		border-bottom: 1px #e5e5e5 dashed;
	}

	.product .content {
		display: flex;
		position: relative;
	}

	.product .box:last-child {
		border-bottom: 0;
	}

	.product .content image {
		width: 140rpx;
		height: 140rpx;
	}

	.product .content .detail {
		display: flex;
		flex-direction: column;
		margin-left: 14rpx;
		flex: 1;
	}

	.product .content .detail .t1 {
		font-size: 26rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.product .content .detail .t2 {
		color: #999;
		font-size: 26rpx;
		margin-top: 10rpx;
	}

	.product .content .detail .t3 {
		display: flex;
		color: #ff4246;
		margin-top: 10rpx;
	}

	.product .content .detail .t4 {
		margin-top: 10rpx;
	}

	.product .content .detail .x1 {
		flex: 1;
	}

	.product .content .detail .x2 {
		width: 100rpx;
		font-size: 32rpx;
		text-align: right;
		margin-right: 8rpx;
	}

	.product .content .comment {
		position: absolute;
		top: 64rpx;
		right: 10rpx;
		border: 1px #ffc702 solid;
		border-radius: 10rpx;
		background: #fff;
		color: #ffc702;
		padding: 0 10rpx;
		height: 46rpx;
		line-height: 46rpx;
	}

	.product .content .comment2 {
		position: absolute;
		top: 64rpx;
		right: 10rpx;
		border: 1px #ffc7c2 solid;
		border-radius: 10rpx;
		background: #fff;
		color: #ffc7c2;
		padding: 0 10rpx;
		height: 46rpx;
		line-height: 46rpx;
	}

	.orderinfo {
		width: 96%;
		margin: 0 2%;
		border-radius: 8rpx;
		margin-top: 16rpx;
		padding: 14rpx 3%;
		background: #fff;
	}

	.orderinfo .item {
		display: flex;
		width: 100%;
		padding: 20rpx 0;
		border-bottom: 1px dashed #ededed;
		overflow: hidden;
	}

	.orderinfo .item:last-child {
		border-bottom: 0;
	}

	.orderinfo .item .t1 {
		width: 200rpx;
		flex-shrink: 0;
	}

	.orderinfo .item .t2 {
		flex: 1;
		text-align: right;
	}

	.orderinfo .item .t3 {
		margin-top: 3rpx;
	}

	.orderinfo .item .red {
		color: red;
	}

	.bottom {
		width: 100%;
		height: 162rpx;
		background: #fff;
		position: fixed;
		bottom: 0px;
		left: 0px;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		padding: 0 15rpx;
	}

	.btn {
		border-radius: 10rpx;
		color: #fff;
	}

	.btn1 {
		height: 60rpx;
		line-height: 60rpx;
		color: #fff;
		border-radius: 3px;
		text-align: center;
		flex-shrink: 0;
		margin: 0 0 0 15rpx;
		padding: 0 15rpx;
	}

	.btn2 {
		height: 60rpx;
		line-height: 60rpx;
		color: #333;
		background: #fff;
		border: 1px solid #cdcdcd;
		border-radius: 3px;
		text-align: center;
		padding: 0 15rpx;
		flex-shrink: 0;
		margin: 0 0 0 15rpx;
	}

	.btn3 {
		font-size: 24rpx;
		height: 50rpx;
		line-height: 50rpx;
		color: #333;
		background: #fff;
		border: 1px solid #cdcdcd;
		border-radius: 3px;
		text-align: center;
		padding: 0 15rpx;
		flex-shrink: 0;
		margin: 0 0 0 15rpx;
	}

	.btitle {
		width: 100%;
		height: 100rpx;
		background: #fff;
		padding: 0 20rpx;
		border-bottom: 1px solid #f5f5f5;
	}

	.btitle .comment {
		border: 1px #ffc702 solid;
		border-radius: 10rpx;
		background: #fff;
		color: #ffc702;
		padding: 0 10rpx;
		height: 46rpx;
		line-height: 46rpx;
	}

	.btitle .comment2 {
		border: 1px #ffc7c0 solid;
		border-radius: 10rpx;
		background: #fff;
		color: #ffc7c0;
		padding: 0 10rpx;
		height: 46rpx;
		line-height: 46rpx;
	}

	.hxqrbox {
		background: #fff;
		padding: 50rpx;
		position: relative;
		border-radius: 20rpx;
	}

	.hxqrbox .img {
		width: 400rpx;
		height: 400rpx;
	}

	.hxqrbox .txt {
		color: #666;
		margin-top: 20rpx;
		font-size: 26rpx;
		text-align: center;
	}

	.hxqrbox .close {
		width: 50rpx;
		height: 50rpx;
		position: absolute;
		bottom: -100rpx;
		left: 50%;
		margin-left: -25rpx;
		border: 1px solid rgba(255, 255, 255, 0.5);
		border-radius: 50%;
		padding: 8rpx;
	}

	.glassitem {
		background: #f5f5f5;
		display: flex;
		align-items: center;
		padding: 10rpx 0;
		font-size: 24rpx;
	}

	.glassitem .gcontent {
		flex: 1;
		padding: 0 20rpx;
	}

	.glassheader {
		line-height: 50rpx;
		font-size: 26rpx;
		font-weight: 600;
	}

	.glassrow {
		line-height: 40rpx;
		font-size: 26rpx;
	}

	.glassrow .glasscol {
		min-width: 25%;
		text-align: center;
	}

	.glassitem .bt {
		border-top: 1px solid #e3e3e3;
	}

	.pstime-item {
		display: flex;
		border-bottom: 1px solid #f5f5f5;
		padding: 20rpx 30rpx;
	}

	.pstime-item .radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #ffffff;
		border: 2rpx solid #bfbfbf;
		border-radius: 50%;
		margin-right: 30rpx;
	}

	.pstime-item .radio .radio-img {
		width: 100%;
		height: 100%;
	}

	.pdl10 {
		padding-left: 10rpx;
	}

	.radio-item {
		display: flex;
		width: 100%;
		color: #000;
		align-items: center;
		background: #fff;
		padding: 20rpx 20rpx;
		border-bottom: 1px dotted #f1f1f1;
	}

	.radio-item:last-child {
		border: 0;
	}

	.radio-item .f1 {
		color: #333;
		font-size: 30rpx;
		flex: 1;
	}

	.storeviewmore {
		width: 100%;
		text-align: center;
		color: #889;
		height: 40rpx;
		line-height: 40rpx;
		margin-top: 10rpx;
	}

	.title-top {
		padding: 20rpx 20rpx 0rpx 20rpx;
		font-weight: 700;
	}

	.tips-box {
		display: flex;
		align-items: center;
		/* background-color: #f4f4f4; */
		justify-content: space-between;
		padding: 20rpx;
	}

	.tips-box-left {
		/* color: #888; */
		font-size: 26rpx;
	}

	.tips-text {
		font-weight: 700;
		color: #fff;
		overflow: hidden;

		display: -webkit-box;

		-webkit-line-clamp: 4;

		-webkit-box-orient: vertical;
	}

	.tips-time {
		margin-top: 20rpx;
		color: #fff;
	}

	.tips-box-right {
		margin-left: 20rpx;
	}

	.arrow-right {
		width: 30rpx;
		height: 30rpx;
	}

	.tips-wl {
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.tab-header {
		display: flex;
		padding: 20rpx 0;
	}

	.tab-item {
		flex: 1;
		text-align: center;
		font-size: 28rpx;
		color: #000;
		position: relative;
		padding: 0 10rpx;
	}

	.tab-item.active {
		color: #fff;
		font-weight: bold;
	}

	.tab-item.active::after {
		content: "";
		position: absolute;
		bottom: -20rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 40rpx;
		height: 4rpx;
		/* background: #ff6b81; */
	}
</style>